import { Body, Controller, Get, Post, Query, UseGuards } from '@nestjs/common';
import { AuthService } from './auth.service';
import { AuthGuard } from '@nestjs/passport';

const { getoss } = require('../provider/oss');

@Controller('auth')
export class AuthController {
  constructor(private readonly authService: AuthService) {}

  @Post('register')
  register(@Body() bodyData: any) {
    return this.authService.register(bodyData);
  }

  @Get('send_email')
  async sendEmail(@Query() queryData: any) {
    return this.authService.sendEmail(queryData);
  }

  @Post('login')
  login(@Body() bodyData: any) {
    return this.authService.login(bodyData);
  }

  @Get('oss')
  @UseGuards(AuthGuard('jwt'))
  oss() {
    return getoss();
  }
}
